package com.zzh.takeoutapp.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zzh.takeoutapp.R;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/8/17.
 */

public class ScreenAdapter extends BaseAdapter {
    private List<String> map;
    private Context mContext;

    public ScreenAdapter(List<String> map, Context mContext) {
        this.map = map;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return map.size();
    }

    @Override
    public Object getItem(int position) {
        return map.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_screen_layout, null);
        TextView textView = view.findViewById(R.id.tv_orderby);
        textView.setText(map.get(position));
        return view;
    }
}
